<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  
</head>
<body>
    <script src="./lib/vue-2.6.10/dist/vue.min.js"></script>
  <div id="app">
    <my-com1></my-com1>
    <mycom2></mycom2>
    <mycom3></mycom3>
  </div>

  <template id="tmpl">
    <div>
      <input type="button" value="+1" @click="increment">
      <h3>{{count}}</h3>
    </div>

  </template>
  <script>
    var com1 = Vue.extend({
      template: '<h3>这时使用Vue.extend创建的组件</h3>'
    })
    Vue.component('myCom1',com1)
    Vue.component('mycom2',{
      template: '<div>hello world</div>',
    })
    Vue.component('mycom3',{
      template: '#tmpl',
       //必须是个方法，这个方法内部还必须返回一个对象
      data: ()=>{
        return {
          count: 0
        }
      },
      methods: {
        increment() {
          this.count+=1;
        }
      }
    })
    var vm = new Vue({
      el: '#app'

    })
  </script>
</body>
</html>